﻿<?xml version="1.0" encoding="utf-8"?>
<!--
        作者：          leyi.liu
        更新时间：      20150923
        用途：          生成应用服务器的初始化数据
-->
<xsl:stylesheet version="2.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:fn="http://www.w3.org/2005/xpath-functions">
	<xsl:output method="text" indent="no" encoding="utf-8" byte-order-mark="no"/>  
	<xsl:template match="/">
	<xsl:result-document encoding="utf-8" method="text" href="./generate/mysql/sql/initdata/dict_init.sql">
delete from t_lz_sys_dict;
delete from t_lz_sys_dictdetail;
<xsl:for-each select="Metadatas/Enum">
insert into t_lz_sys_dict(DictCode,DictName,DictDesc,OperID,OperDate)values('<xsl:value-of select="@typename"/>','<xsl:value-of select="@label"/>','','sys',now());
<xsl:variable name="DictCode" select="@typename"/>
<xsl:for-each select="Item"> 
insert into t_lz_sys_dictdetail(DictCode,DictItem,DictItemDesc,OperID,OperDate)values('<xsl:value-of select="$DictCode"/>','<xsl:value-of select="@value"/>','<xsl:value-of select="@desc"/>','sys',now());
</xsl:for-each>
</xsl:for-each>
 commit;
</xsl:result-document>
	</xsl:template>  
</xsl:stylesheet>
